<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>加票</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="/${BasePath}/static/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="/${BasePath}/static/css/public.css" media="all" type="text/css">
</head>
<body class="childrenBody">
	<div class="list">
		<table class="layui-table">
			<tbody>
				<#if gifts ??>
				<#list gifts as gift>
					<tr>
						<td width="900">价格${gift.price!''}元：${gift.votenum!''}票</td>
						<td width="100"><a class="layui-btn layui-btn-sm layui-btn-normal addTicket" data-id="${gift.votenum!''}">加票</a></td>
					</tr>
				</#list>
				</#if>
			</tbody>
		</table>
	</div>
<script src="/${BasePath}/static/layui/layui.js" charset="utf-8" type="text/javascript"></script>
<script type="text/javascript" src="/${BasePath}/static/js/common/jquery-2.1.0.min.js"></script>

<script type="text/javascript">
layui.use(['form','layer'],function(){
    var form = layui.form,
    layer = layui.layer;
	$(document).on('click','.addTicket',function(e){
		e.stopPropagation();
		var poll = $(this).attr("data-id");
    	layer.confirm('确定要给该选手加票？',{icon:3, title:'提示信息'},function(index){
            $.ajax({
                cache: true,
                type: "POST",
                url: "/${BasePath}/activity/saveAddTicket",
                data:{"id":${id!''},"poll":poll},
                async: false,
                error: function(request) {
                    layer.msg('系统错误！');
                },
                success: function(data) {
                    if(data.code == "1") {
                        layer.msg(data.msg, {
                            time: 1000
                        }, function() { //提示框设定显示1秒
                        	window.parent.location.reload();
                        })
                    } else {
                        layer.msg(data.msg);
                    }
                }
            });
       });
	})
})
</script>
</body>
</html>